In JavaScript, the double exclamation mark (!!) is used to convert a value to a boolean (true or false).
The first ! (negation) converts the value to its boolean opposite:
falsetrueThe second ! negates the result again:
false → truetrue → false
!!?true or false.
In this case, !!userInput ensures that the condition is evaluated as a boolean (true or false).